//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//

package com.imu.security;

import com.fasterxml.jackson.databind.node.ObjectNode;
import java.io.Serializable;

public class SessionObject implements Serializable
{
    private static final long serialVersionUID = 3375056256139536601L;
    //密钥
    private String secret;
    //token
    private String token;
    //id
    private String id;
    //昵称
    private String username;
    //性别
    private String sex;
    //终端
    private String term;
    //开始时间
    private long startTime;
    //超时时间
    private long expirationTime;
    //对象锁
    private Object lock = new Object();

    public String getToken() {
        return this.token;
    }

    public String getId() {
        return this.id;
    }
    
    public String getUsername() {
        return this.username;
    }

    public long getStartTime() {
        return this.startTime;
    }

    public long getExpirationTime() {
        return this.expirationTime;
    }

    public void setExpirationTime(long expirationTime) {
        Object var3 = this.lock;
        synchronized(var3) {
            this.expirationTime = expirationTime;
        }
    }
    
    public void setToken(String token) {
		this.token = token;
	}

	public void setId(String id) {
		this.id = id;
	}
	
	public void setUsername(String username) {
		this.username = username;
	}

	public void setStartTime(long startTime) {
		this.startTime = startTime;
	}

	public SessionObject() {}

    private SessionObject(String token, String id, String username, String sex, String secret, String term, long startTime, long expirationTime) 
    {
        this.token = token;
        this.id = id;
        this.username=username;
        this.sex = sex;
        this.id = id;
        this.term = term;
        this.secret = secret;
        this.startTime = startTime;
        this.expirationTime = expirationTime;
    }

    public static SessionObject create(String token, String id, String username, String sex, String secret, String term, long startTime, long expirationTime) 
    {
        return new SessionObject(token, id, username, sex, secret, term, startTime, expirationTime);
    }

    public static SessionObject create(ObjectNode sessionJSON)
    {
        return new SessionObject(sessionJSON.get(SessionKeys.TOKEN.toString()).asText(), sessionJSON.get(SessionKeys.USERID.toString()).asText(), sessionJSON.get(SessionKeys.USERNAME.toString()).asText(), sessionJSON.get(SessionKeys.SEX.toString()).asText(), sessionJSON.get(SessionKeys.SECRET.toString()).asText(), sessionJSON.get(SessionKeys.TERM.toString()).asText(), sessionJSON.get(SessionKeys.START_TIME.toString()).asLong(), sessionJSON.get(SessionKeys.EXPIRE_TIME.toString()).asLong());
    }

	public String getSex() {
		return sex;
	}

	public void setSex(String sex) {
		this.sex = sex;
	}

	public String getSecret() {
		return secret;
	}

	public void setSecret(String secret) {
		this.secret = secret;
	}

	public String getTerm() {
		return term;
	}

	public void setTerm(String term) {
		this.term = term;
	}
}
